# -*- coding: utf-8 -*-
# Project : flacon
# File : flac_encoder.py
# (c) Alexander Sokolov sokoloff.a@gmail.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

from PyQt4.QtCore import *
import flaconglobal

from encoderConfigPage import EncoderConfigPage
from aac_config_ui import Ui_aacConfigPage as UI

class AacConfig(EncoderConfigPage, UI):

   #****************************************************************
   #
   #****************************************************************
    @classmethod
    def defaults(cls):
        return {
            'Aac/UseQuality':       True,
            'Aac/Quality':          100,
            'Aac/Bitrate':          256,
        }


   #****************************************************************
   #
   #****************************************************************
    def __init__(self, parent):
        EncoderConfigPage.__init__(self, parent)
        self.setupUi(self)

        self.setLossyToolTip(self.aacQualitySpin)
        self.aacQualitySlider.setToolTip(self.aacQualitySpin.toolTip())
        self.fillBitrateComboBox(self.aacBitrateCbx,  [64, 80, 128, 160, 192, 224, 256, 288, 320])

        self.loadCheckBox('Aac/UseQuality', self.aacUseQualityCheck)
        self.loadSpinBox( 'Aac/Quality',    self.aacQualitySpin)
        self.loadComboBox('Aac/Bitrate',    self.aacBitrateCbx)


   #****************************************************************
   #
   #****************************************************************
    def write(self):
        self.writeCheckBox('Aac/UseQuality',self.aacUseQualityCheck)
        self.writeSpinBox( 'Aac/Quality',   self.aacQualitySpin)
        self.writeComboBox('Aac/Bitrate',   self.aacBitrateCbx)
        pass
